package com.mariusz.data.rules;


import java.util.ArrayList;
import java.util.List;

import com.mariusz.data.DataContainer;
import com.mariusz.data.dto.Property;
import com.mariusz.data.dto.Rentier;
import com.mariusz.data.dto.Room;

public class EmptyRoomRule implements Rule {

	@Override
	public List<String> processMessages(DataContainer dt) {
		List<String> messages = new ArrayList<String>();
		
		for(Property p : dt.getProperties()){
			for(Room room: p.getRooms()){
				boolean hasTenant = false;
				for(Rentier r : dt.getRentiers()){
					if(room.equals(r.getRoom())){
						hasTenant = true;
						break;
					}
				}
				if(!hasTenant){
					
					messages.add("In Property \""+p.getName()+"\" you have an empty room \""+room.getName()+"\".");
				}
			}
			
		}
		
		return messages;
	}

}
